From 5710d594f1121cebe1e2476368549ae11d9af874 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 7 Oct 2025 10:42:19 +0200 Subject: [PATCH] luci-mod-network: clean up btn1 and btn2 disable In the current source, it is difficult to see when the disable button should be shown or not. This commit adjusts this and moves the handling to an if else statement, so that it can be easily seen. Signed-off-by: Florian Eckert --- .../resources/view/network/interfaces.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index f7e092e49a..3574115d3c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -305,8 +305,26 @@ return view.extend({ ]); } - btn1.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic; - btn2.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic || disabled; + if (isReadonlyView === true) { + btn1.disabled = true; + btn2.disabled = true; + } + else if (btn1.classList.contains('spinning') || btn2.classList.contains('spinning')) { + btn1.disabled = true; + btn2.disabled = true; + } + else if (dynamic === true) { + btn1.disabled = true; + btn2.disabled = true; + } + else if (disabled === true) { + btn1.disabled = false; + btn2.disabled = true; + } + else { + btn1.disabled = false; + btn2.disabled = false; + } } document.querySelectorAll('.port-status-device[data-device]').forEach(function(node) { -- 2.30.2